package com.example.myapplication;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MyReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        Log.e("mjt", " action =" + action);
        if (Intent.ACTION_SCREEN_ON.equals(action)) {
            //屏幕关闭
            Log.d("mjt", "屏幕打开");
        } else if (Intent.ACTION_SCREEN_ON.equals(action)) {
            Log.d("mjt", "屏幕关闭");
        }
    }
}